package demon2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class Dog extends Animal implements IRunning,ISwimming{
    public Dog(String name, int age) {
        super(name, age);
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

//    @Override
//    public boolean equals(Object obj) {
//        Dog tmp =(Dog)obj;
//        return tmp.name.equals(this.name)&&tmp.age==this.age;
//    }



    public static void main(String[] args) {
        Dog dog1 =new Dog("旺财",11);
        Dog dog2 =new Dog("旺财",11);
//        System.out.println(dog1.equals(dog2));
        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());
    }

    @Override
    public void run() {
        System.out.println(this.name+"正在跑");
    }

    @Override
    public void swim() {
        System.out.println(this.name+"正在游泳");
    }
}
